package cc.minos.servers.openfire.model
{
	
	/**
	 * ...
	 * @author Minos
	 */
	public class ConfigParameters
	{
		public static const TEST_SERVER:String = "openfire.tt.gzedu.com";
		public static const LIVE_SERVER:String = "eenetlive.eecn.cn";
		public static const MY_SERVER:String = "minos-ee";
		public static const GTALK_SERVER:String = "talk.google.com";
		
		private var _skin:String = "assets/skin.swf";
		private var _emoticons:String = "assets/emoticons.txt";
		public var globalurl:String = "";
		
		public var debug:Boolean = true;
		public var userlist:Boolean = false;
		public var anonymous:Boolean = false;
		public var chatslist:Boolean = true;
		public var systeminfo:Boolean = false;
		public var duplication:Boolean = false;
		
		public var roomname:String = "2012测试答疑";
		public var nickname:String = "admin";
		public var username:String = "admin";
		public var password:String = "admin";
		public var chatrooms:String = "conference";
		
		public var server:String = MY_SERVER;
		public var domain:String = MY_SERVER;
		
		public var connectionType:String = "default";
		public var port:Number = 5222;
		
		public var width:Number = 500;
		public var height:Number = 500;
		
		public function ConfigParameters()
		{
		}
		
		public function parse( conf:Object ):void
		{
			if ( conf == null )
				return;
			
			if ( conf.server != undefined )
				server = conf.server.toString();
			if ( conf.domain != undefined )
				domain = conf.domain.toString();
			if ( conf.globalurl != undefined )
				globalurl = conf.globalurl.toString();
			if ( conf.emoticons != undefined )
				_emoticons = conf.emoticons.toString();
			if ( conf.skin != undefined )
				_skin = conf.skin.toString();
			
			if ( conf.nickname != undefined )
				nickname = conf.nickname.toString();
			if ( conf.roomname != undefined )
				roomname = conf.roomname.toString();
			if ( conf.chatrooms != undefined )
				chatrooms = conf.chatrooms.toString();
			
			if ( conf.anonymous != undefined )
				anonymous = conf.anonymous.toUpperCase() == "TRUE" ? true : false;
			if ( conf.userlist != undefined )
				userlist = conf.userlist.toUpperCase() == "TRUE" ? true : false;
			if ( conf.debug != undefined )
				debug = conf.debug.toUpperCase() == "TRUE" ? true : false;
			if ( conf.chatslist != undefined )
				chatslist = conf.chatslist.toUpperCase() == "TRUE" ? true : false;
			if ( conf.systeminfo != undefined )
				systeminfo = conf.systeminfo.toUpperCase() == "TRUE" ? true : false;
			if ( conf.duplication != undefined )
				duplication = conf.duplication.toUpperCase() == "TRUE" ? true : false;
			
			if ( conf.width != undefined )
				width = Number( conf.width );
			if ( conf.height != undefined )
				height = Number( conf.height );
		
		}
		
		public function get skin():String
		{
			return globalurl + _skin;
		}
		
		public function get emoticons():String
		{
			return globalurl + _emoticons;
		}
	
	}

}